// 测试代码
#include "../logs/logslearn.h"

//进行功能测试
void test_log(const std::string &name){
   INFO( "%s", "测试开始");
    logslearn::Logger::ptr logger=logslearn::LoggerManager::getInstance().getLogger(name);
    //测试日志打印
    logger->debug( "%s", "测试日志");
    logger->info( "%s", "测试日志");
    logger->warn( "%s", "测试日志");
    logger->error( "%s", "测试日志");
    logger->fatal("%s", "测试日志");
    INFO( "%s", "测试结束");
    //kais
}
int main()
{
    std::unique_ptr<logslearn::LoggerBuilder> builder(new logslearn::GlobalLoggerBuilder());
    //建造者构建零部件
    builder->buildLoggerName("sync_logger");
    builder->buildLoggerLevel(logslearn::loglevel::value::DEBUG);
    builder->buildLoggerFormatter("[%d{%H:%M:%S}][%t][%c][%p]%m%n");
    builder->buildLoggerType(logslearn::LoggerType::LOGGER_SYNC);
    builder->buildSink<logslearn::StdoutSink>();                                 // 标准输出落地
    builder->buildSink<logslearn::FileSink>("./logfile/sync.log"); // 文件落地方式
    builder->buildSink<logslearn::RoolBySizeSink>("./logfile/roll-", 1024 * 1024); // 滚动文件落地方式
    builder->build();
    
    test_log("sync_logger");

    return 0;
}